import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)
// 路由表
const routes = [
  {
    path: '/adminLogin',
    name: 'adminLogin',
    component: () => import('@/views/login/adminLogin')
  },
  {
    path: '/login',
    name: 'login',
    component: () => import('@/views/login/index')
  },
  {
    path: '/reg',
    name: 'reg',
    component: () => import('@/views/reg/reg')
  },
  {
    path: '/',
    // name: 'layout',
    component: () => import('@/views/layout/index'),

    children: [{
      path: '/', // 默认子路由 只能有一个
      redirect: '/home'
    },
    {
      path: '/userwaiting',
      name: 'userwaiting',
      component: () => import('@/views/home/userwaiting')
    },
    {
      path: '/home',
      name: 'home',
      component: () => import('@/views/home/index')
    },
    {
      path: '/manage',
      name: 'manage',
      component: () => import('@/views/home/manage')
    },

    {
      path: '/my',
      name: 'my',
      component: () => import('@/views/my')
    }]
  },
  {
    path: '/search',
    name: 'search',
    component: () => import('@/views/search/index')
  },

  {
    path: '/user/profile',
    name: 'user-profile',
    component: () => import('@/views/user-profile')

  }

]

const router = new VueRouter({
  routes
})

export default router
